from matplotlib import rcParams
import matplotlib.pyplot as plt
import numpy as np
import re


##显示中文
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = 'SimSun,Times New Roman'

text = ''
file = open('D:\\学业\\个人\\毕业论文\\ACLNet-main\\train data\\app_100loss_8_output.log')  ##我的log.txt文件是放在了和python文件同级别目录下

for line in file:
    text += line
file.close()
all_list = re.findall('loss: .*[0-9]',text)

train_loss = []
for i in all_list:
    train_loss.append(float(i.split(' - diceCoef: ')[0].split('loss: ')[1]))  
     ##分割出score_loss的数值

plt.plot(train_loss,label='loss')
plt.title('ACLNet-100-8 best')
plt.xlabel('epoch')
plt.legend(loc='best')
plt.show()



